<?php

namespace app\controllers;

use Yii;
use yii\web\Controller;
use app\models\Goods;
class DemoController extends Controller
{
    public function actionIndex()
    {
        return $this->render("index");
    }

    public function actionDemo_add()
    {
        $data = Yii::$app->request->post();
        $model = new Goods();
        $res = $model->getAdd($data);

        if($res)
        {
            return $this->redirect(['demo/show']);
        }else{
            return $this->redirect(['demo/demo_add']);
        }
    }

    public function actionShow()
    {
        $model = new Goods();

        return $model->getAll();
    }


}
